//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.domain.SysStaff;
import com.ruoyi.system.domain.vo.StaffVo;
import com.ruoyi.system.mapper.SysStaffMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysStaffServiceImpl implements ISysStaffService {
    @Resource
    private SysStaffMapper sysStaffMapper;
    @Resource
    private SysUserMapper sysUserMapper;
    @Autowired
    private TokenService tokenService;

    //public SysStaffServiceImpl() {
    //}

    public SysStaff selectSysStaffByEmpNo(String empNo) {
        return this.sysStaffMapper.selectSysStaffByEmpNo(empNo);
    }

    public List<SysStaff> selectSysStaffList(SysStaff sysStaff) {
        return this.sysStaffMapper.selectSysStaffList(sysStaff);
    }

    public List<SysStaff> selectSysStaffjoinSysDept(SysStaff sysStaff) {
        if (StringUtils.isBlank(sysStaff.getOrgNo())) {
            sysStaff.setOrgNo(this.tokenService.getLoginUser().getSysUser().getOrgNo());
        }

        return this.sysStaffMapper.selectSysStaffSysDept(sysStaff);
    }

    public int insertSysStaff(SysStaff sysStaff) {
        return this.sysStaffMapper.insertSysStaff(sysStaff);
    }

    public int updateSysStaff(SysStaff sysStaff) {
        return this.sysStaffMapper.updateSysStaff(sysStaff);
    }

    public int deleteSysStaffByEmpNos(String[] empNos) {
        return this.sysStaffMapper.deleteSysStaffByEmpNos(empNos);
    }

    public int deleteSysStaffByEmpNo(String empNo) {
        return this.sysStaffMapper.deleteSysStaffByEmpNo(empNo);
    }

    public List<SysStaff> selectSysStaffjoinSysDept1(SysStaff sysStaff) {
        return this.sysStaffMapper.selectSysStaffSysDept1(sysStaff);
    }

    public List<StaffVo> selectOrgUserList(String orgNo) {
        return this.sysUserMapper.selectOrgUserList(orgNo);
    }
}
